home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define NUMREGIONS 25
- #define BlockSize 10
- #define CorrectTime 5
-
- void RescueRaiders(GrafPtr);
-
- /* One region in 8 parts. Each part of the region either starts at a corner
- or in the middle of a side and moves progressively clockwise until the
- entire screen is filled. Named after a similar effect in the game Rescue
- Raiders on the Apple ][e (now called Armor Alley™ on the Mac, but it doesn't
- have this effect in it anymore). */
-
- void RescueRaiders(GrafPtr sourceGrafPtr)
- {
- RgnHandle curregion;
- Rect source;
- int cx,cy,lastx,lasty,VBlockSize;
-
- cx = (gMainWindow->portRect.right + gMainWindow->portRect.left) / 2;
- cy = (gMainWindow->portRect.bottom + gMainWindow->portRect.top) / 2;
- VBlockSize=BlockSize*MAIN_WINDOW_HEIGHT/MAIN_WINDOW_WIDTH;
-
- source.top=source.left=0;
- source.bottom=MAIN_WINDOW_HEIGHT;
- source.right=MAIN_WINDOW_WIDTH;
-
- lasty=lastx=0;
- curregion=NewRgn();
- do
- {
- StartTiming();
-
- SetEmptyRgn(curregion);
- MoveTo(cx,cy);
- OpenRgn();
- LineTo(lastx,0);
- Line(BlockSize,0);
- LineTo(MAIN_WINDOW_WIDTH-lastx-BlockSize,MAIN_WINDOW_HEIGHT);
- Line(BlockSize,0);
- LineTo(cx,cy);
-
- LineTo(cx+lastx,0);
- Line(BlockSize,0);
- LineTo(cx-lastx-BlockSize,MAIN_WINDOW_HEIGHT);
- Line(BlockSize,0);
- LineTo(cx,cy);
-
- LineTo(MAIN_WINDOW_WIDTH,lasty);
- Line(0,VBlockSize);
- LineTo(0,MAIN_WINDOW_HEIGHT-lasty-VBlockSize);
- Line(0,VBlockSize);
- LineTo(cx,cy);
-
- LineTo(MAIN_WINDOW_WIDTH,cy+lasty);
- Line(0,VBlockSize);
- LineTo(0,cy-lasty-VBlockSize);
- Line(0,VBlockSize);
- LineTo(cx,cy);
- CloseRgn(curregion);
-
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, curregion);
-
- lastx+=BlockSize;
- lasty+=VBlockSize;
-
- TimeCorrection(CorrectTime);
- }
- while (lastx<cx);
-
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &source, &source, 0, 0L); /* in case we missed any bits */
-
- DisposeRgn(curregion);
- }
-